<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      .banner {
        float: left;
        width: 1000px;
        height: 250px;
        background-color: #cecece;
      }
      .banner div {
        width: 50px;
        height: 50px;
        margin: 25px;
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div class="banner">
      <div></div>
      <div></div>
      <div></div>
    </div>
    <script>
      var aDiv = document.querySelectorAll(".banner div");
      function Program_bar(myElement, max) {
        var widthNum = 1;
        var maxWidth = max;
        var t = setInterval(function () {
          widthNum++;
          if (widthNum < maxWidth) {
            myElement.style.width = widthNum + "px";
          } else {
            clearInterval(t);
          }
        }, 1);
      }
      var num = ["900", "500", "200"];
      for (var i = 0; i < aDiv.length; i++) {
        Program_bar(aDiv[i], num[i]);
      }
    </script>
  </body>
</html>
